package com.lct.param;

public class MethodParamTest3 {
    public static void main(String[] args) {
        //掌握数组的案例，输出数组的内容
        int[] arr = {11,33,66,88,35};
        printArray(arr);

        printArray(null);
    }


    public static void printArray(int[] arr){
        if (arr == null){
            System.out.println(arr);
            return;
        }
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {

            System.out.print(i == arr.length - 1 ? arr[i] : arr[i] + ",");

//            if(i == arr.length - 1)
//                System.out.print(arr[i]);
//            else
//                System.out.print(arr[i] + ",");

        }

        System.out.println("]");

    }
}
